package com.tcm.service;

import com.tcm.entity.Notification;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tcm.entity.dto.NotificationDto;
import com.tcm.entity.dto.param.NotificationPageParam;
import com.tcm.entity.vo.NotificationListResult;
import com.tcm.entity.resp.PageR;
import com.tcm.entity.vo.NotificationStuResult;
import com.tcm.exception.DatabaseOperationException;
import org.springframework.transaction.annotation.Transactional;

/**
* @author Guqier
* @description 针对表【ts_notification(通知、公告)】的数据库操作Service
* @createDate 2023-07-28 16:49:10
*/
public interface NotificationService extends IService<Notification> {

    @Transactional
    boolean addNotification(NotificationDto dto, Long currUserId) throws DatabaseOperationException;

    @Transactional
    boolean removeNotification(Long id, Long currUserId) throws DatabaseOperationException;

    PageR<NotificationListResult> getNotificationListByPage(NotificationPageParam param);

    PageR<NotificationStuResult> getStuNotifications(Integer current, Integer pageSize, Long currUserId);

    NotificationStuResult getStuRollNotification(Long currUserId);

    boolean readNotification(Long id, Long currUserId);

    /**
     * 发送通知给学生
     * @param title 标题
     * @param content 内容
     * @param type 通知类型
     * @param isRoll 是否滚动通知
     * @param account 学生账号
     * @param currUserId 当前用户ID
     * @return 发送结果
     */
    boolean addNotificationForStudent(String title, String content, Integer type, Integer isRoll, String account, Long currUserId);
}
